<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>笑话展示</title>
    <link rel="stylesheet" href="/static/css/bootstrap.css">
</head>
<body>
<form >
    <input type="text" name="keyword"><input type="submit" value="搜索">
</form>
<table class="table">
    <th>ID</th>
    <th>内容</th>
    <th>updatetime</th>
    <th>hashId</th>
    <th>unixtime</th>

    <th>deletetime</th>
    {foreach $data as $k=>$v}
    <tr>
        <td>{$v.id}</td>
        <td>{$v.content}</td>
        <td>{$v.updatetime}</td>
        <td>{$v.unixtime}</td>
        <td>{$v.hashId}</td>
        <td>
<!--            <a href="deldata?id={$v.id}">同步软删除</a>-->
            <button id="{$v.id}" class="one" >异步软删除{$v.id}</button>
        </td>
    </tr>
    {/foreach}
</table>
</body>
<script src="/static/js/jquery-3.1.1.min.js"></script>
<script>
 $("button").click(function () {
     var id=$(this).attr('id');//这里一点要用this，才可以有效果
        console.log(id);
       $.get(   //感觉有bug post和get 都可以成功
           'deldata?id='+id,
           // {id:id},
           function (data) {
               if (data.code==1){
                   alert(data.msg);
               }
                 console.log(data);
           }
       )
 })
</script>
</html>